package com.ansion.view.pin_view;


import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.AsyncDifferConfig;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.RecyclerView;

public abstract class PinnedHeaderListAdapter<T, VH extends RecyclerView.ViewHolder>  extends ListAdapter<T, VH> {

    public static final int PIN_TYPE = 1000111;

    protected PinnedHeaderListAdapter(@NonNull DiffUtil.ItemCallback<T> diffCallback) {
        super(diffCallback);
    }

    protected PinnedHeaderListAdapter(@NonNull AsyncDifferConfig<T> config) {
        super(config);
    }

    /**
     * 判断该position对应的位置是要固定
     *
     * @param position adapter position
     * @return true or false
     */
    public abstract boolean isPinnedPosition(int position);


    public RecyclerView.ViewHolder onCreatePinnedViewHolder(ViewGroup parent, int viewType) {
        return onCreateViewHolder(parent, viewType);
    }

    public void onBindPinnedViewHolder(VH holder, int position) {
        onBindViewHolder(holder, position);
    }

}
